#define mod 1000000007
#define ll long long
#define ull unsigned long long
#define cy cout << "YES" << endl
#define cn cout << "NO" << endl
#define pb push_back
#define ff first
#define ss second
#define N 100005
// #include <boost/multiprecision/cpp_int.hpp>
#include <bits/stdc++.h>
//#include <unordered_map>
#define endl "\n"
using namespace std;
ll gcd(ll a, ll b) { if (a > b)swap(a, b); if (a == 0) return b; return gcd(b % a, a); }
int pow2(ll n) { ll c = 0; while (n % 2 == 0 && n != 0) { c++; n /= 2; } return c; }
ll m_mod(ll x, ll y) { return ((x % mod) * (y % mod)) % mod; }
ll power(ll x, ll y, ll M)
{
if (y == 0)
return 1;
int p = power(x, y / 2, M) % M;
p = (p * p) % M;
return (y % 2 == 0) ? p : (x * p) % M;
}
ll modInverse(ll A, ll M)
{
return power(A, M - 2, M);
}
void solve()
{
ll n,q;
cin >> n >> q;
set<pair<ll,ll> > s;
vector<pair<ll,ll> > v;
for(ll i = 0;i<q;i++){
ll l,r;
cin >> l >> r;
v.pb(make_pair(l,r));
}
ll c_block = 0;
for(ll i = 0;i<q;i++){
if(s.find(v[i]) == s.end()){
s.insert(v[i]);
if(v[i].ff == 1){
if(s.find(make_pair(v[i].ff+1,v[i].ss)) != s.end()){
c_block++;
}
if(s.find(make_pair(v[i].ff+1,v[i].ss+1)) != s.end() && v[i].ss < n){
c_block++;
}
if(s.find(make_pair(v[i].ff+1,v[i].ss-1)) != s.end() && v[i].ss > 1){
c_block++;
}
}
else{
if(s.find(make_pair(v[i].ff-1,v[i].ss)) != s.end()){
c_block++;
}
if(s.find(make_pair(v[i].ff-1,v[i].ss+1)) != s.end() && v[i].ss < n){
c_block++;
}
if(s.find(make_pair(v[i].ff-1,v[i].ss-1)) != s.end() && v[i].ss > 1){
c_block++;
}
}
}
else{
if(v[i].ff == 1){
if(s.find(make_pair(v[i].ff+1,v[i].ss)) != s.end()){
c_block--;
}
if(s.find(make_pair(v[i].ff+1,v[i].ss+1)) != s.end() && v[i].ss < n){
c_block--;
}
if(s.find(make_pair(v[i].ff+1,v[i].ss-1)) != s.end() && v[i].ss > 1){
c_block--;
}
}
else{
if(s.find(make_pair(v[i].ff-1,v[i].ss)) != s.end()){
c_block--;
}
if(s.find(make_pair(v[i].ff-1,v[i].ss+1)) != s.end() && v[i].ss < n){
c_block--;
}
if(s.find(make_pair(v[i].ff-1,v[i].ss-1)) != s.end() && v[i].ss > 1){
c_block--;
}
}
s.erase(v[i]);
}
if(c_block > 0){
cn;
}
else{
cy;
}
}
}
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
//cin >> t;
for (int i = 0; i < t; i++)
{
//cout << "Case #" << i+1 << ": ";
solve();
}
return 0;
}
628. Maximum Product of Three Numbers | 1526A - Mean Inequality |
1526B - I Hate 1111 | 1881. Maximum Value after Insertion |
237. Delete Node in a Linked List | 27. Remove Element |
39. Combination Sum | 378. Kth Smallest Element in a Sorted Matrix |
162. Find Peak Element | 1529A - Eshag Loves Big Arrays |
19. Remove Nth Node From End of List | 925. Long Pressed Name |
1051. Height Checker | 695. Max Area of Island |
402. Remove K Digits | 97. Interleaving String |
543. Diameter of Binary Tree | 124. Binary Tree Maximum Path Sum |
1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts | 501A - Contest |
160A- Twins | 752. Open the Lock |
1535A - Fair Playoff | 1538F - Interesting Function |
1920. Build Array from Permutation | 494. Target Sum |
797. All Paths From Source to Target | 1547B - Alphabetical Strings |
1550A - Find The Array | 118B - Present from Lena |